<?php
require_once("page.php");

//------------------------------------------------------------
// Set some values into the template engine
//------------------------------------------------------------
$eng->assign("PageTitle", "RadTemplate");
$eng->assign("PageSubTitle", "Example 5b - Iteration using ForEach");

//------------------------------------------------------------
// Declare the Top Five Reasone Array
//------------------------------------------------------------
$dctTopFive = array(
	 array(1, "Fast"),
	 array(2, "Flexible"),
	 array(3, "Extensible"),
	 array(4, "Powerful"),
	 array(5, "Free")
);

$eng->assign("ListMessage", "Top Five Reasons to use RadTemplate (ForEach)");

//------------------------------------------------------------
// Put Array into values Collection
//------------------------------------------------------------
$eng->assign("TopFive", $dctTopFive);

//------------------------------------------------------------
// The iterator I chose requires that I define
// this particular function for it to call.
//------------------------------------------------------------
function OnItem($node, $val, $status) {
	$node->assign("ListKey", $val[0]);
	$node->assign("ListValue", $val[1]);
	// return True to continue, False to stop iteration early
	return True;
}

//------------------------------------------------------------
// NOTE:
//------------------------------------------------------------
// There are two other predefined ArrayIterators
// iterators CForItemJ, or CForItemK which invoke the
// OnItemJ( ) and OnItemK( ) functions.

//------------------------------------------------------------
// Load the template and Generate Ouput
//------------------------------------------------------------
$eng->show("tpl/test05b.html");
?>